package com.ch.home.bean;

import java.util.Date;

/**
 * 对局结果
 * Created by CHEN on 2019/8/24.
 */
public class GameInfo {
    private Integer gameId;
    private Integer gameNameId;
    private Integer player1Id;
    private Integer player1Score;
    private Integer player2Id;
    private Integer player2Score;
    private Date time;
    private Integer winner;

    private String gameName;//查询的时候需要得到的游戏名


    public GameInfo() {
    }

    public GameInfo(Integer gameId, Integer gameNameId, Integer player1Id, Integer player1Score, Integer player2Id, Integer player2Score, Date time, Integer winner, String gameName) {
        this.gameId = gameId;
        this.gameNameId = gameNameId;
        this.player1Id = player1Id;
        this.player1Score = player1Score;
        this.player2Id = player2Id;
        this.player2Score = player2Score;
        this.time = time;
        this.winner = winner;
        this.gameName = gameName;
    }

    public Integer getGameNameId() {

        return gameNameId;
    }

    public void setGameNameId(Integer gameNameId) {
        this.gameNameId = gameNameId;
    }

    public Integer getPlayer1Id() {
        return player1Id;
    }

    public void setPlayer1Id(Integer player1Id) {
        this.player1Id = player1Id;
    }

    public Integer getPlayer1Score() {
        return player1Score;
    }

    public void setPlayer1Score(Integer player1Score) {
        this.player1Score = player1Score;
    }

    public Integer getPlayer2Id() {
        return player2Id;
    }

    public void setPlayer2Id(Integer player2Id) {
        this.player2Id = player2Id;
    }

    public Integer getPlayer2Score() {
        return player2Score;
    }

    public void setPlayer2Score(Integer player2Score) {
        this.player2Score = player2Score;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public Integer getWinner() {
        return winner;
    }

    public void setWinner(Integer winner) {
        this.winner = winner;
    }

    public String getGameName() {
        return gameName;
    }

    public void setGameName(String gameName) {
        this.gameName = gameName;
    }

    public Integer getGameId() {

        return gameId;
    }

    public void setGameId(Integer gameId) {
        this.gameId = gameId;
    }

    @Override
    public boolean equals(Object o) {

        if (this == o) return true;
        if (o == null || getClass( ) != o.getClass( )) return false;

        GameInfo gameInfo = (GameInfo) o;

        if (gameId != null ? !gameId.equals(gameInfo.gameId) : gameInfo.gameId != null) return false;
        if (gameNameId != null ? !gameNameId.equals(gameInfo.gameNameId) : gameInfo.gameNameId != null) return false;
        if (player1Id != null ? !player1Id.equals(gameInfo.player1Id) : gameInfo.player1Id != null) return false;
        if (player1Score != null ? !player1Score.equals(gameInfo.player1Score) : gameInfo.player1Score != null)
            return false;
        if (player2Id != null ? !player2Id.equals(gameInfo.player2Id) : gameInfo.player2Id != null) return false;
        if (player2Score != null ? !player2Score.equals(gameInfo.player2Score) : gameInfo.player2Score != null)
            return false;
        if (time != null ? !time.equals(gameInfo.time) : gameInfo.time != null) return false;
        if (winner != null ? !winner.equals(gameInfo.winner) : gameInfo.winner != null) return false;
        return gameName != null ? gameName.equals(gameInfo.gameName) : gameInfo.gameName == null;
    }

    @Override
    public int hashCode() {
        int result = gameId != null ? gameId.hashCode( ) : 0;
        result = 31 * result + (gameNameId != null ? gameNameId.hashCode( ) : 0);
        result = 31 * result + (player1Id != null ? player1Id.hashCode( ) : 0);
        result = 31 * result + (player1Score != null ? player1Score.hashCode( ) : 0);
        result = 31 * result + (player2Id != null ? player2Id.hashCode( ) : 0);
        result = 31 * result + (player2Score != null ? player2Score.hashCode( ) : 0);
        result = 31 * result + (time != null ? time.hashCode( ) : 0);
        result = 31 * result + (winner != null ? winner.hashCode( ) : 0);
        result = 31 * result + (gameName != null ? gameName.hashCode( ) : 0);
        return result;
    }

    @Override
    public String toString() {
        return "GameInfo{" +
                "gameId=" + gameId +
                ", gameNameId=" + gameNameId +
                ", player1Id=" + player1Id +
                ", player1Score=" + player1Score +
                ", player2Id=" + player2Id +
                ", player2Score=" + player2Score +
                ", time=" + time +
                ", winner=" + winner +
                ", gameName='" + gameName + '\'' +
                '}';
    }
}
